﻿Public Class Frm3Proveedores_RMP
    Public Sub cargarRegistros(ByVal fila As Integer)
        Try
            Dim accion As New SocioDAO
            'Llenar tabla
            Dim tabla As New DataTable
            tabla = accion.mostrar
            'Comprobar si hay datos
            If Not tabla Is Nothing Then
                'Cargar datos en el grid
                'DGV1.DataSource = tabla
                FormatosGrid.funciones.formatoGrid_Socios(DGV1, tabla)
                'Mostrar datos en los controles
                lblIDSocio.Text = DGV1.Rows(fila).Cells(0).Value
                txtCodigo.Text = DGV1.Rows(fila).Cells(1).Value
                txtNombre.Text = DGV1.Rows(fila).Cells(2).Value
                txtDireccion.Text = DGV1.Rows(fila).Cells(3).Value
                txtDocumento.Text = DGV1.Rows(fila).Cells(4).Value
                txtTelefono.Text = DGV1.Rows(fila).Cells(5).Value
                txtEmail.Text = DGV1.Rows(fila).Cells(6).Value
                txtContacto.Text = DGV1.Rows(fila).Cells(7).Value
                lblTipo.Text = DGV1.Rows(fila).Cells(8).Value
                lblIdTSocio.Text = DGV1.Rows(fila).Cells(9).Value
                'Seleccionar toda la fila
                DGV1.Rows(fila).Selected = True
                DGV1.CurrentCell = DGV1.Rows(fila).Cells(1)
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message, "Advertencia", MessageBoxButtons.OK,
                        MessageBoxIcon.Warning)
        End Try
    End Sub
    Private Sub dgv1_CurrentCellChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DGV1.CurrentCellChanged
        Try
            If Not DGV1.CurrentCell Is Nothing Then
                With DGV1
                    lblIDSocio.Text = .Rows(.CurrentCell.RowIndex).Cells(0).Value
                    txtCodigo.Text = .Rows(.CurrentCell.RowIndex).Cells(1).Value
                    txtNombre.Text = .Rows(.CurrentCell.RowIndex).Cells(2).Value
                    txtDireccion.Text = .Rows(.CurrentCell.RowIndex).Cells(3).Value
                    txtDocumento.Text = .Rows(.CurrentCell.RowIndex).Cells(4).Value
                    txtTelefono.Text = .Rows(.CurrentCell.RowIndex).Cells(5).Value
                    txtEmail.Text = .Rows(.CurrentCell.RowIndex).Cells(6).Value
                    txtContacto.Text = .Rows(.CurrentCell.RowIndex).Cells(7).Value
                    lblTipo.Text = .Rows(.CurrentCell.RowIndex).Cells(8).Value
                    lblIdTSocio.Text = .Rows(.CurrentCell.RowIndex).Cells(9).Value
                End With
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message, "Advertencia", MessageBoxButtons.OK,
              MessageBoxIcon.Warning)
        End Try
    End Sub
    Private Sub Frm2ClientesMenu_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        cargarRegistros(0)
        txtCodigo.Enabled = False
        txtNombre.Enabled = False
        txtDireccion.Enabled = False
        txtDocumento.Enabled = False
        txtTelefono.Enabled = False
        txtEmail.Enabled = False
        txtContacto.Enabled = False
    End Sub



    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Me.Close()
    End Sub
End Class